<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>
<div class="row">
    <div class="col-lg-12">
        <div class="btn-group mb-3" role="group">
            <a role="button" class="btn btn-secondary active" href="<?php echo url('collection-list');?>">采集管理</a>
            <a role="button" class="btn btn-secondary" href="<?php echo url('collection-add');?>">添加采集</a>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="table-responsive">
                <table class="table table-sm" style="min-width: 800px">
                    <thead>
                    <tr>
                        <th width="400">标题：</th>
                        <th>网址：</th>
                        <th>操作：</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php if (is_array($url))foreach ($url as $v){?>
                    <tr>
                        <td><?php echo $v['title']; ?></td>
                        <td><?php echo $v['url']; ?></td>
                        <td><a onclick="showpretest('<?php echo $v['url']; ?>', <?php echo $id;?>);" href="javascript:void(0);">查看</a></td>
                    </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!-- Modal -->
<div class="modal" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">测试网址：</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div style="max-height:400px; overflow:auto; " id="publictestcontent">
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<!-- Modal -->
<div class="modal" id="loading" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-body">
                加载中...
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>


<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>
<script>
    function showpretest(url, id) {
        $('#loading').modal('show');
        $.post("<?php echo url('collection-publictestcontent');?>", {url:url,id:id}, function(data) {
            $('#loading').modal('hide');
            $('#publictestcontent').html(data);
            $('#exampleModal').modal('show');
        })
    }
</script>